home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performDuplicate.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  17.9 KB  |  707 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  November 18, 1996
  22. //
  23. //  Description:
  24. //      Duplicate option box script.
  25. //
  26.  
  27. //
  28. //  Procedure Name:
  29. //      setOptionVars
  30. //
  31. //  Description:
  32. //        Initialize the option values.
  33. //
  34. //  Input Arguments:
  35. //        Whether to set the options to default values.
  36. //
  37. //  Return Value:
  38. //      None.
  39. //
  40. proc setOptionVars (int $forceFactorySettings)
  41. {
  42.     //    Rename Children flag
  43.     //
  44.     if ($forceFactorySettings || !`optionVar -exists duplicateRenameChildren`) {
  45.         optionVar -intValue duplicateRenameChildren false;
  46.     }
  47.  
  48.     //    Smart transform flag
  49.     //
  50.     if ($forceFactorySettings || !`optionVar -exists duplicateSmart`) {
  51.         optionVar -intValue duplicateSmart false;
  52.     }
  53.  
  54.     //    Number of duplicates
  55.     //
  56.     if ($forceFactorySettings || !`optionVar -exists duplicateCount`) {
  57.         optionVar -intValue duplicateCount 1;
  58.     }
  59.  
  60.     //    Copy flag
  61.     //
  62.     if ($forceFactorySettings || !`optionVar -exists duplicateCopy`) {
  63.         optionVar -intValue duplicateCopy true;
  64.     }
  65.  
  66.     //    Group flag
  67.     //
  68.     if ($forceFactorySettings || !`optionVar -exists duplicateGroup`) {
  69.         optionVar -intValue duplicateGroup 1;
  70.     }
  71.  
  72.     //    Duplicate upstream nodes flag
  73.     //
  74.     if ($forceFactorySettings || !`optionVar -exists duplicateUpstream`) {
  75.         optionVar -intValue duplicateUpstream false;
  76.     }
  77.  
  78.     //    Duplicate input Connections flag
  79.     //
  80.     if ($forceFactorySettings || !`optionVar -exists duplicateInputConn`) {
  81.         optionVar -intValue duplicateInputConn false;
  82.     }
  83.  
  84.     //    Translate values
  85.     //
  86.     if ($forceFactorySettings || !`optionVar -exists duplicateTX`) {
  87.         optionVar -floatValue duplicateTX 0.0;
  88.     }
  89.     if ($forceFactorySettings || !`optionVar -exists duplicateTY`) {
  90.         optionVar -floatValue duplicateTY 0.0;
  91.     }
  92.     if ($forceFactorySettings || !`optionVar -exists duplicateTZ`) {
  93.         optionVar -floatValue duplicateTZ 0.0;
  94.     }
  95.  
  96.     //    Rotate values
  97.     //
  98.     if ($forceFactorySettings || !`optionVar -exists duplicateRX`) {
  99.         optionVar -floatValue duplicateRX 0.0;
  100.     }
  101.     if ($forceFactorySettings || !`optionVar -exists duplicateRY`) {
  102.         optionVar -floatValue duplicateRY 0.0;
  103.     }
  104.     if ($forceFactorySettings || !`optionVar -exists duplicateRZ`) {
  105.         optionVar -floatValue duplicateRZ 0.0;
  106.     }
  107.  
  108.     //    Scale values
  109.     //
  110.     if ($forceFactorySettings || !`optionVar -exists duplicateSX`) {
  111.         optionVar -floatValue duplicateSX 1.0;
  112.     }
  113.     if ($forceFactorySettings || !`optionVar -exists duplicateSY`) {
  114.         optionVar -floatValue duplicateSY 1.0;
  115.     }
  116.     if ($forceFactorySettings || !`optionVar -exists duplicateSZ`) {
  117.         optionVar -floatValue duplicateSZ 1.0;
  118.     }
  119. }
  120.  
  121. //
  122. //  Procedure Name:
  123. //      duplicateSetup
  124. //
  125. //  Description:
  126. //        Update the state of the option box UI to reflect the option values.
  127. //
  128. //  Input Arguments:
  129. //      parent               - Top level parent layout of the option box UI.
  130. //                             Required so that UI object names can be 
  131. //                             successfully resolved.
  132. //
  133. //    forceFactorySettings - Whether the option values should be set to
  134. //                             default values.
  135. //
  136. //  Return Value:
  137. //      None.
  138. //
  139. global proc duplicateSetup (string $parent, int $forceFactorySettings)
  140. {
  141.     // Retrieve the option settings
  142.     //
  143.     setOptionVars ($forceFactorySettings);
  144.  
  145.     setParent $parent;
  146.  
  147.     //    Query the optionVar's and set the values into the controls.
  148.     //
  149.     int $renameChildren = `optionVar -q duplicateRenameChildren`;
  150.     int $numDuplicates = `optionVar -q duplicateCount`;
  151.     int $smart = `optionVar -q duplicateSmart`;
  152.     int $copy  = `optionVar -q duplicateCopy`;
  153.     int $group = `optionVar -q duplicateGroup`;
  154.     if ($group == 0) $group = 1;    // Earlier boolean false should now map to 1
  155.     int $upstream = `optionVar -q duplicateUpstream`;
  156.     int $inputConn = `optionVar -q duplicateInputConn`;
  157.  
  158.     //    Rename Children flag
  159.     //
  160.     checkBoxGrp -edit -value1 $renameChildren renameChildrenField;
  161.  
  162.     //    Number of duplicates
  163.     //
  164.     intSliderGrp -e -v $numDuplicates numDuplicatesField;
  165.  
  166.     //    Smart transform flag
  167.     //
  168.     checkBoxGrp -edit -value1 $smart smartCheck;
  169.  
  170.     //    Copy flag
  171.     //
  172.     int $boolToOption[] = { 2, 1 };
  173.     radioButtonGrp -edit -select $boolToOption[$copy] 
  174.         geometryTypeGroup;
  175.  
  176.     //    Group flag
  177.     //
  178.     radioButtonGrp -e -select $group otherOptionsGroup;
  179.  
  180.     //    Duplicate upstream nodes flag
  181.     //
  182.     checkBoxGrp -edit -value1 $upstream upstreamCheck;
  183.  
  184.     //    Duplicate input Connections flag
  185.     //
  186.     checkBoxGrp -edit -value1 $inputConn inputConnCheck;
  187.  
  188.     //    Translate values
  189.     //
  190.     float $tx = `optionVar -q duplicateTX`;
  191.     float $ty = `optionVar -q duplicateTY`;
  192.     float $tz = `optionVar -q duplicateTZ`;
  193.     floatFieldGrp -edit -value1 $tx -value2 $ty -value3 $tz transField;
  194.  
  195.     //    Rotate values
  196.     //
  197.     float $rx = `optionVar -q duplicateRX`;
  198.     float $ry = `optionVar -q duplicateRY`;
  199.     float $rz = `optionVar -q duplicateRZ`;
  200.     floatFieldGrp -edit -value1 $rx -value2 $ry -value3 $rz rotateField;
  201.  
  202.     //    Scale values
  203.     //
  204.     float $sx = `optionVar -q duplicateSX`;
  205.     float $sy = `optionVar -q duplicateSY`;
  206.     float $sz = `optionVar -q duplicateSZ`;
  207.     floatFieldGrp -edit -value1 $sx -value2 $sy -value3 $sz scaleField;
  208.  
  209.     duplicateOptionsUpdateEnableState($parent);
  210. }
  211.  
  212. global proc duplicateOptionsUpdateEnableState(string $parent)
  213. //
  214. //    Description:
  215. //        Update the enable state of all the option box controls.
  216. //
  217. //        Call this whenever any of the control values changes.
  218. //
  219. {
  220.     int $smartTransform;
  221.     int $makeInstance;
  222.     int $groupParent;
  223.     int $simpleCopy;
  224.     int $upstreamGraph;
  225.     int $inputConnections;
  226.     int $numberOfDuplicates;
  227.     int $enableSmartTransform;
  228.     int $enableTRSFields;
  229.  
  230.     setParent $parent;
  231.  
  232.     //    Determine the number of duplicates.
  233.     //
  234.     $numberOfDuplicates = `intSliderGrp -query -value numDuplicatesField`;
  235.  
  236.     //    Determine if smart transform is on.
  237.     //
  238.     $smartTransform = `checkBoxGrp -query -value1 smartCheck`;
  239.  
  240.     //    Determine if copying geometry or making instance.
  241.     //
  242.     $copyGeometry = true;
  243.     if (2 == `radioButtonGrp -query -select geometryTypeGroup`) {
  244.         $copyGeometry = false;
  245.     }
  246.  
  247.     //    Determine if duplicate is to be under the parent.
  248.     //
  249.     $groupParent = false;
  250.     if (1 == `radioButtonGrp -query -select otherOptionsGroup`) {
  251.         $groupParent = true;
  252.     }
  253.  
  254.     //    Determine if settings describe a simple copy, ie. no duplication
  255.     //    of Upstream graph or Input connections.
  256.     //
  257.     $simpleCopy = true;
  258.     $upstreamGraph = `checkBoxGrp -query -value1 upstreamCheck`;
  259.     $inputConnections = `checkBoxGrp -query -value1 inputConnCheck`;
  260.     if ($upstreamGraph || $inputConnections) {
  261.         $simpleCopy = false;
  262.     }
  263.  
  264.     //    Enable Smart Transform check box...
  265.     //
  266.     $enableSmartTransform = false;
  267.     if (1 == $numberOfDuplicates && $groupParent && $simpleCopy) {
  268.         $enableSmartTransform = true;
  269.     }
  270.     checkBoxGrp -edit -enable $enableSmartTransform smartCheck;
  271.  
  272.     //    Enable Translate, rotate and scale fields...
  273.     //
  274.     $enableTRSFields = false;
  275.     if (!$smartTransform && $simpleCopy) {
  276.         $enableTRSFields = true;
  277.     }
  278.     floatFieldGrp -edit -enable $enableTRSFields transField;
  279.     floatFieldGrp -edit -enable $enableTRSFields rotateField;
  280.     floatFieldGrp -edit -enable $enableTRSFields scaleField;
  281.  
  282.     //    Enable Upstream Graph and Input Connection check boxes...
  283.     //
  284.     checkBoxGrp -edit -enable ($copyGeometry && !$inputConnections) upstreamCheck;
  285.     checkBoxGrp -edit -enable ($copyGeometry && !$upstreamGraph) inputConnCheck;
  286.  
  287.     //    Enable Geometry Type radio button...
  288.     //
  289.     radioButtonGrp -edit -enable $simpleCopy geometryTypeGroup;
  290. }
  291.  
  292. //
  293. //  Procedure Name:
  294. //      duplicateCallback
  295. //
  296. //  Description:
  297. //        Update the option values with the current state of the option box UI.
  298. //
  299. //  Input Arguments:
  300. //      parent - Top level parent layout of the option box UI.  Required so
  301. //               that UI object names can be successfully resolved.
  302. //
  303. //        doIt   - Whether the command should execute.
  304. //
  305. //  Return Value:
  306. //      None.
  307. //
  308. global proc duplicateCallback (string $parent, int $doIt)
  309. {
  310.     setParent $parent;
  311.  
  312.     //    Set the optionVar's from the control values, and then
  313.     //    perform the command
  314.  
  315.     //    Smart transform flag
  316.     //
  317.     optionVar -intValue duplicateSmart 
  318.         `checkBoxGrp -q -v1 smartCheck`;
  319.  
  320.     //    Rename Children flag
  321.     //
  322.     optionVar -intValue duplicateRenameChildren 
  323.         `checkBoxGrp -q -v1 renameChildrenField`;
  324.  
  325.     //    Number of duplicates
  326.     //
  327.     optionVar -intValue duplicateCount
  328.         `intSliderGrp -q -v numDuplicatesField`;
  329.  
  330.     //    Instance flag
  331.     //
  332.     int $optionToBool[] = { 0, true, false };
  333.     int $i = `radioButtonGrp -q -select geometryTypeGroup`;
  334.     optionVar -intValue duplicateCopy $optionToBool[$i];
  335.  
  336.     //    Group flag
  337.     //
  338.     optionVar -intValue duplicateGroup
  339.         `radioButtonGrp -q -select otherOptionsGroup`;
  340.  
  341.     //    Duplicate upstream nodes flag
  342.     //
  343.     optionVar -intValue duplicateUpstream
  344.         `checkBoxGrp -q -v1 upstreamCheck`;
  345.  
  346.     //    Duplicate input Connections flag
  347.     //
  348.     optionVar -intValue duplicateInputConn
  349.         `checkBoxGrp -q -v1 inputConnCheck`;
  350.  
  351.     //    Translate values
  352.     //
  353.     optionVar -floatValue duplicateTX
  354.         `floatFieldGrp -q -v1 transField`;
  355.     optionVar -floatValue duplicateTY
  356.         `floatFieldGrp -q -v2 transField`;
  357.     optionVar -floatValue duplicateTZ
  358.         `floatFieldGrp -q -v3 transField`;
  359.  
  360.     //    Rotate values
  361.     //
  362.     optionVar -floatValue duplicateRX
  363.         `floatFieldGrp -q -v1 rotateField`;
  364.     optionVar -floatValue duplicateRY
  365.         `floatFieldGrp -q -v2 rotateField`;
  366.     optionVar -floatValue duplicateRZ
  367.         `floatFieldGrp -q -v3 rotateField`;
  368.  
  369.     //    Scale values
  370.     //
  371.     optionVar -floatValue duplicateSX
  372.         `floatFieldGrp -q -v1 scaleField`;
  373.     optionVar -floatValue duplicateSY
  374.         `floatFieldGrp -q -v2 scaleField`;
  375.     optionVar -floatValue duplicateSZ
  376.         `floatFieldGrp -q -v3 scaleField`;
  377.     
  378.     if ($doIt) {
  379.         performDuplicate 0; 
  380.         addToRecentCommandQueue "performDuplicate 0" "Duplicate";
  381.     }
  382. }
  383.  
  384. //
  385. //  Procedure Name:
  386. //      duplicateOptions
  387. //
  388. //  Description:
  389. //        Construct the option box UI.  Involves accessing the standard option
  390. //        box and customizing the UI accordingly.
  391. //
  392. //  Input Arguments:
  393. //      None.
  394. //
  395. //  Return Value:
  396. //      None.
  397. //
  398. proc duplicateOptions ()
  399. {
  400.     //    Name of the command for this option box.
  401.     //
  402.     string $cmdName        = "duplicate";
  403.  
  404.     //    Build the option box actions.
  405.     //
  406.     string $callback = ($cmdName + "Callback");
  407.     string $setup = ($cmdName + "Setup");
  408.  
  409.     //    STEP 1:  Get the option box.
  410.     //    ============================
  411.     //
  412.     //  The value returned is the name of the layout to be used as
  413.     //    the parent for the option box UI.
  414.     //
  415.     string $layout = getOptionBox();
  416.     setParent $layout;
  417.  
  418.     //    STEP 2:  Pass the command name to the option box.
  419.     //    =================================================
  420.     //
  421.     //    Any default option box behaviour based on the command name is set 
  422.     //    up with this call.  For example, updating the 'Help' menu item with
  423.     //    the name of the command.
  424.     //
  425.     setOptionBoxCommandName($cmdName);
  426.  
  427.     //    STEP 3:  Activate the default UI template.
  428.     //    ==========================================
  429.     //
  430.     //    Activate the default UI template so that the layout of this 
  431.     //    option box is consistent with the layout of the rest of the 
  432.     //    application.
  433.     //
  434.     setUITemplate -pushTemplate DefaultTemplate;
  435.     
  436.     //    Turn on the wait cursor.
  437.     //
  438.     waitCursor -state 1;
  439.  
  440.     //    STEP 4: Create option box contents.
  441.     //    ===================================
  442.     //
  443.     tabLayout -scr true -tv false;
  444.     string $parent = `columnLayout -adjustableColumn 1`;
  445.  
  446.     floatFieldGrp -label "Translate"
  447.         -numberOfFields 3
  448.         transField;
  449.  
  450.     floatFieldGrp -label "Rotate"
  451.         -numberOfFields 3 
  452.         rotateField;
  453.  
  454.     floatFieldGrp -label "Scale"
  455.         -numberOfFields 3 
  456.         scaleField;
  457.  
  458.     intSliderGrp  -label "Number of Copies"
  459.         -field true
  460.         -minValue 1
  461.         -maxValue 100
  462.         -fieldMaxValue 1000
  463.         -changeCommand ("duplicateOptionsUpdateEnableState " + $parent)
  464.         numDuplicatesField;
  465.  
  466.     separator -style "in";
  467.  
  468.     radioButtonGrp
  469.         -label "Geometry Type"
  470.         -numberOfRadioButtons 2 -label1 "Copy" -label2 "Instance"
  471.         -changeCommand ("duplicateOptionsUpdateEnableState " + $parent)
  472.         geometryTypeGroup;
  473.  
  474.     radioButtonGrp -numberOfRadioButtons 3 -label "Group under"
  475.         -label1 "Parent" 
  476.         -label2 "World" 
  477.         -label3 "New Group" 
  478.         -changeCommand ("duplicateOptionsUpdateEnableState " + $parent)
  479.         otherOptionsGroup;
  480.  
  481.     checkBoxGrp -numberOfCheckBoxes 1
  482.         -label1 "Smart Transform"
  483.         -changeCommand ("duplicateOptionsUpdateEnableState " + $parent)
  484.         smartCheck;
  485.  
  486.     separator -style "in";
  487.  
  488.     checkBoxGrp
  489.         -numberOfCheckBoxes 1
  490.         -label1 "Duplicate Input Graph"
  491.         -changeCommand ("duplicateOptionsUpdateEnableState " + $parent)
  492.         upstreamCheck;
  493.  
  494.     checkBoxGrp
  495.         -numberOfCheckBoxes 1
  496.         -label1 "Duplicate Input Connections"
  497.         -changeCommand ("duplicateOptionsUpdateEnableState " + $parent)
  498.         inputConnCheck;
  499.  
  500.     separator -style "in";
  501.  
  502.     checkBoxGrp
  503.         -numberOfCheckBoxes 1
  504.         -label1 "Assign Unique Name to Child Nodes"
  505.         -value1    0
  506.         renameChildrenField;
  507.  
  508.     //    Turn off the wait cursor.
  509.     //
  510.     waitCursor -state 0;
  511.     
  512.     //    Step 5: Deactivate the default UI template.
  513.     //    ===========================================
  514.     //
  515.     setUITemplate -popTemplate;
  516.     
  517.     //    Step 6: Customize the buttons.  
  518.     //    ==============================
  519.     //
  520.     //    Provide more descriptive labels for the buttons.
  521.     //    Disable those buttons that are not applicable to the option box.
  522.     //    Attach actions to those buttons that are applicable to the option
  523.     //    box.
  524.  
  525.     //    'Apply' button.
  526.     //
  527.     string $applyBtn = getOptionBoxApplyBtn();
  528.     button -edit
  529.         -label "Duplicate"
  530.         -command ($callback + " " + $parent + " " + 1)
  531.         $applyBtn;
  532.  
  533.     //    'Save' button.
  534.     //
  535.     string $saveBtn = getOptionBoxSaveBtn();
  536.     button -edit 
  537.         -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
  538.         $saveBtn;
  539.  
  540.     //    'Reset' button.
  541.     //
  542.     string $resetBtn = getOptionBoxResetBtn();
  543.     button -edit 
  544.         -command ($setup + " " + $parent + " " + 1)
  545.         $resetBtn;
  546.  
  547.     //    Set the option box title.
  548.     //    =========================
  549.     //
  550.     setOptionBoxTitle("Duplicate Options");
  551.  
  552.     //    Customize the 'Help' menu item text.
  553.     //
  554.     setOptionBoxHelpTag( "Duplicate" );
  555.  
  556.     //    Set the current values of the option box.
  557.     //    =========================================
  558.     //
  559.     eval (($setup + " " + $parent + " " + 0));    
  560.  
  561.     //    Show the option box.
  562.     //    ====================
  563.     //
  564.     showOptionBox();
  565. }
  566.  
  567. //
  568. //  Procedure Name:
  569. //      duplicateHelp
  570. //
  571. //  Description:
  572. //        Return a short description about this command.
  573. //
  574. //  Input Arguments:
  575. //      None.
  576. //
  577. //  Return Value:
  578. //      string.
  579. //
  580. proc string duplicateHelp()
  581. {
  582.     return 
  583.     "  Command: Duplicate - create a copy of selected objects.\n" +
  584.     "Selection: objects.";
  585. }
  586.  
  587. //
  588. //  Procedure Name:
  589. //      assembleCmd
  590. //
  591. //  Description:
  592. //        Construct the command that will apply the option box values.
  593. //
  594. //  Input Arguments:
  595. //      None.
  596. //
  597. //  Return Value:
  598. //      None.
  599. //
  600. proc string assembleCmd()
  601. {
  602.     string $cmd = "duplicatePreset";
  603.  
  604.     setOptionVars(false);
  605.  
  606.     int $count   = `optionVar -q duplicateCount`;
  607.     int $copy    = `optionVar -q duplicateCopy`;
  608.     int $group   = `optionVar -q duplicateGroup`;
  609.     int $smart   = `optionVar -q duplicateSmart`;
  610.     int $upstream = `optionVar -q duplicateUpstream`;
  611.     int $inputConn = `optionVar -q duplicateInputConn`;
  612.     int $renameChild = `optionVar -q duplicateRenameChildren`;
  613.  
  614.     float $transX = `optionVar -q duplicateTX`;
  615.     float $transY = `optionVar -q duplicateTY`;
  616.     float $transZ = `optionVar -q duplicateTZ`;
  617.  
  618.     float $rotatX = `optionVar -q duplicateRX`;
  619.     float $rotatY = `optionVar -q duplicateRY`;
  620.     float $rotatZ = `optionVar -q duplicateRZ`;
  621.  
  622.     float $scaleX = `optionVar -q duplicateSX`;
  623.     float $scaleY = `optionVar -q duplicateSY`;
  624.     float $scaleZ = `optionVar -q duplicateSZ`;
  625.  
  626.     $cmd = ($cmd + "("
  627.         + $count + ","
  628.         + $copy + ","
  629.         + $group + ","
  630.         + $smart + ","
  631.         + $upstream + ","
  632.         + $inputConn + ","
  633.         + $renameChild + ","
  634.  
  635.         + $transX + ","
  636.         + $transY + ","
  637.         + $transZ + ","
  638.  
  639.         + $rotatX + ","
  640.         + $rotatY + ","
  641.         + $rotatZ + ","
  642.  
  643.         + $scaleX + ","
  644.         + $scaleY + ","
  645.         + $scaleZ + ")"
  646.         );
  647.  
  648.     return $cmd;
  649. }
  650.  
  651. //
  652. //  Procedure Name:
  653. //      performDuplicate
  654. //
  655. //  Description:
  656. //        Perform the duplicate command using the corresponding 
  657. //        option values.  This procedure will also show the option box
  658. //        window if necessary as well as construct the command string
  659. //        that will invoke the duplicate command with the current
  660. //        option box values.
  661. //
  662. //  Input Arguments:
  663. //      0 - Execute the command.
  664. //      1 - Show the option box dialog.
  665. //      2 - Return the command.
  666. //
  667. global proc string performDuplicate (int $action)
  668. {
  669.     string $cmd = "";
  670.  
  671.     switch ($action) {
  672.  
  673.         //    Execute the command.
  674.         //
  675.         case 0:
  676.             //    Get the command.
  677.             //
  678.             $cmd = `assembleCmd`;
  679.  
  680.             //    Execute the command with the option settings.
  681.             //
  682.             //    *NOTE* we do NOT want to use evalEcho here because
  683.             //    this calls the duplicatePreset command which does
  684.             //    the command echoing.
  685.             //
  686.             eval($cmd);
  687.  
  688.             break;
  689.  
  690.         //    Show the option box.
  691.         //
  692.         case 1:
  693.             duplicateOptions();
  694.             break;
  695.  
  696.         //    Return the command string.
  697.         //
  698.         case 2:
  699.             //    Get the command.
  700.             //
  701.             $cmd = `assembleCmd`;
  702.             break;
  703.     }
  704.     return $cmd;
  705. }
  706.  
  707.